package com.example.qjia.Presenters;

import com.example.qjia.Listener.LoadStudentMessageListener;
import com.example.qjia.data.StudentMessage;
import com.example.qjia.data.romotedata.Student;
import com.example.qjia.model.LoadMessageModel;
import com.example.qjia.model.LoadMessageModelImp;
import com.example.qjia.model.LoadStudentMessageModel;
import com.example.qjia.model.LoadStudentMessageModelImp;
import com.example.qjia.ui.ViewInterface.UserMesageInterface;

/**
 * Created by ying_xiang on 2016/8/15.
 */
public class StudentMessagePresenterImp implements StudentMessagePresenter,LoadStudentMessageListener {
    private UserMesageInterface userMesageInterface;
    private LoadStudentMessageModel loadStudentMessageModel;

    public StudentMessagePresenterImp(UserMesageInterface userMesageInterface) {
        this.userMesageInterface = userMesageInterface;
        loadStudentMessageModel=new LoadStudentMessageModelImp();
    }

    @Override
    public void loadStudentMessageSeccess(Student studentMessage) {
        userMesageInterface.setStudentMessage(studentMessage);
    }

    @Override
    public void loadFailed() {
        userMesageInterface.failed();


    }

    @Override
    public void loginOut() {
        userMesageInterface.loginOut();

    }

    @Override
    public void loadStudentMessage() {

        loadStudentMessageModel.loadStudentMessage(this);

    }

    @Override
    public void destroy() {
        userMesageInterface=null;
        loadStudentMessageModel=null;

    }
}
